<?php
namespace app\api\controller;
use think\facade\Db;
class News extends Base{

    //列表数据
    public function get_list(){
        $param = input('');
        $listData = Db::table('an_news')
        // ->fetchSql(true)//输出mysql语句
        ->page($param['page'],$param['limit'])
        ->where('a_show','1')
        ->order('id desc')
        ->select()
        ->toArray(); 
        $this->info['data'] = [
            'list' => $listData,
            'type' => []
        ];
        $this->info['total'] = Db::table('an_news')->where('a_show','1')->count();
        return json($this->info);
    }

    public function get_detail($id){
        $info = Db::table('an_news')->where('id',$id)->find();
        $this->info['data'] = $info;
        return json($this->info);
    }  
}
